<extend name="./Application/Admin/View/Layout/application.html"/>
<!-- sidebar end -->

<!-- content start -->
<block name="content">
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">新增分类</strong> /
                    <small>Create A New Category</small>
                </div>
            </div>

            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-12">

                    <form class="am-form" action="{{:U('add')}}" method="post">

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                上级分类
                            </div>
                            <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                <select data-am-selected="{btnWidth: '100%',  btnStyle: 'secondary', btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                        name="parent_id">
                                    <option value="0">顶级分类</option>

                                    <volist name="categories" id="category">
                                        <option value="{{$category.id}}">{{$category.name}}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                分类名称
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" minlength="3" required name="name">
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">是否显示</div>
                            <div class="am-u-sm-8 am-u-md-10">
                                <div class="am-btn-group" >
                                    <label class="am-radio-inline">
                                        <input type="radio" value="1" name="is_show" > 是
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" value="0" name="is_show"> 否
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                描述信息
                            </div>
                            <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                <textarea rows="4" name="description" required></textarea>
                            </div>
                        </div>

                        <div class="am-g am-margin-top sort">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                排序
                            </div>
                            <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                <input type="text" name="sort_order" class="am-input-sm" value="99">
                            </div>
                        </div>

                        <div class="am-margin">
                            <button type="submit" class="am-btn am-btn-primary am-radius">提交保存</button>
                        </div>
                    </form>
                </div>
            </div>

            <footer class="admin-content-footer">
                <hr>
                <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
            </footer>
        </div>
    </div>

    <!-- content end -->
</block>
<block name="js">
    <script src="__PUBLIC__/vendor/bootstrapextend/js/bootstrap.extend.js"></script>
    <script src="__PUBLIC__/vendor/validate/jquery.validate.js"></script>
    <script src="__PUBLIC__/vendor/validate/localization/messages_zh.js"></script>

    <script>

        $(function () {

            $(".am-form").validate({
                onfocusout: function (element) {
                    $(element).valid();
                }
            })
        })
    </script>

</block>


